package tech.aistar.corejava.day06.HomeWork;

import java.util.Arrays;

/**
 * Created by 李雨昂 on 2019/7/22.
 */

//业务银行类
public class Bank {
    //初始化50个容量的Account数组 用于 保存账户信息
    Account[] accountArr = new Account[0];

    //开户
    public void registAccount(Account account){


        accountArr = Arrays.copyOf(accountArr,accountArr.length + 1);

        accountArr[accountArr.length - 1] = account;

    }
    //存款
    public static void depoist(Account acc,double money){

        acc.setAccBalance(acc.getAccBalance() - money);
    }

    //取款
    public static void withdraw(Account acc,double money){
        if (acc.getAccType() == 1){
            CreditAccount c = (CreditAccount) acc;
            if(c.getCredit() >= 100){

            }
        }
        acc.setAccBalance(acc.getAccBalance() + money);
    }

}